from rest_framework import serializers
from rest_framework.serializers import ModelSerializer

from rooms.models import VideoUserInfo, Room, VideoLoginUser


class RoomCodeSerializer(ModelSerializer):
    """
    视频会议房间
    """
    class Meta:
        model = Room
        fields = ["id", "description", "secret", "pin", "numbers"]


class RoomSerializer(ModelSerializer):
    """
    视频会议房间
    """
    status_name = serializers.CharField(source='get_status_display', read_only=True)

    class Meta:
        model = Room
        exclude = ["update_time", "add_time"]


class VideoLoginUserSerializer(ModelSerializer):
    """
    视频登录用户信息
    """

    class Meta:
        model = VideoLoginUser
        exclude = ["update_time", "add_time"]


class VideoUserInfoSerializer(ModelSerializer):
    """
    视频用户信息
    """
    sex_name = serializers.CharField(source='get_sex_display', read_only=True)

    class Meta:
        model = VideoUserInfo
        exclude = ["update_time", "add_time"]

